package com.zmn.plat.services.impl.orderconfig.oderstock.channel;

import java.util.Collections;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zmn.plat.model.entity.orderconfig.orderstock.channel.ChannelConfigClose;
import com.zmn.plat.model.entity.orderconfig.orderstock.channel.ChannelConfigCloseQuery;
import com.zmn.plat.persistence.interfaces.orderconfig.orderstock.channel.ChannelConfigCloseDao;
import com.zmn.plat.services.interfaces.orderconfig.oderstock.channel.ChannelConfigCloseService;

import lombok.extern.slf4j.Slf4j;

/**
 * 描述: 渠道库存配置：关闭日期基础接口实现类
 *
 * @author tanghongjun
 * @since 2020-03-17 10:29:08
 **/
@Slf4j
@Service
public class ChannelConfigCloseServiceImpl implements ChannelConfigCloseService {

    private static final String TAG = "渠道库存配置：关闭日期基础服务接口";

    @Resource
    private ChannelConfigCloseDao channelConfigCloseDao;

    @Override
    public ChannelConfigClose findByKey(Integer id) {
        return channelConfigCloseDao.findByKey(id);
    }

    @Override
    public List<ChannelConfigClose> listPageByQuery(ChannelConfigCloseQuery query) {
        Integer count = countByQuery(query);
        query.setTotalCount(count);
        return count > 0 ? channelConfigCloseDao.listPageByQuery(query) : Collections.emptyList();
    }

    @Override
    public List<ChannelConfigClose> listByQuery(ChannelConfigCloseQuery query) {
        return channelConfigCloseDao.listByQuery(query);
    }

    @Override
    public Integer countByQuery(ChannelConfigCloseQuery query) {
        return channelConfigCloseDao.countByQuery(query);
    }

    @Override
    public Integer updateByKey(ChannelConfigClose channelConfigClose) {
        return channelConfigCloseDao.updateByKey(channelConfigClose);
    }

    @Override
    public Integer insert(ChannelConfigClose channelConfigClose) {
        return channelConfigCloseDao.insert(channelConfigClose);
    }

    @Override
    public Integer insertBatch(List<ChannelConfigClose> list) {
        return channelConfigCloseDao.insertBatch(list);
    }

    @Override
    public Integer deleteByKey(Integer id) {
        return channelConfigCloseDao.deleteByKey(id);
    }

    @Override
    public void copy(Integer originalChannelId, int targetChannelId, String operator) {

        channelConfigCloseDao.copy(originalChannelId, targetChannelId, operator);
    }
}